<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在线购买状态</title>
    <meta http-equiv="refresh" content="20">
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body onload="getOnlineStatus()">

<div class="cn_online_status"></div>

<script type="application/javascript">
    function getOnlineStatus() {
        $.getJSON("onlineStatus", function showStatus(data) {
            for (var key in data) {
                $(".cn_online_status").append(data[key].iphoneName).append("是否可以购买：");
                if (data[key].online) {
                    $(".cn_online_status").append("<h3 style='display: inline'>YES</h3>").append("    购买链接:<a target=&quot;_blank&quot; href='"+data[key].buyingUrl+"'>"+data[key].buyingUrl+"</a>").append("<br/>");
                } else {
                    $(".cn_online_status").append("<h3 style='display: inline;color: red'>NO</h3>").append("    购买链接:<a target=&quot;_blank&quot; href='"+data[key].buyingUrl+"'>"+data[key].buyingUrl+"</a>").append("<br/>");
                }
            }
        })
    }

</script>
</body>
</html>